<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="Shortcut Icon" href="../images/aecc.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="../StaticFiles/element-ui/element-ui.css">
  <link rel="stylesheet" href="../StaticFiles/nprogress/nprogress.min.css">
  <link rel="stylesheet" href="../styles/vue-page-common.css">
  <script src="../Scripts/vue.min.js"></script>
  <script src="../StaticFiles/element-ui/element-ui.js"></script>
  <script src="../Scripts/axios.min.js"></script>
  <script src="../StaticFiles/nprogress/nprogress.min.js"></script>
  <script src="../Scripts/dayjs.min.js"></script>
  <script src="../Scripts/axios.config.js"></script>
  <script src="../Scripts/datav.min.vue.js"></script>
  <script src="../Scripts/lodash.min.js"></script>
  <title>准时完成率趋势看板</title>
  <style>
    html {
      background-image: url(../images/bg.jpg);
      color: #fff;
    }

    .el-form-item__label {
      color: #fff;
    }

    .el-date-editor--daterange.el-input,
    .el-date-editor--daterange.el-input__inner,
    .el-date-editor--timerange.el-input,
    .el-date-editor--timerange.el-input__inner {
      width: 280px !important;
    }

    .el-form-item {
      margin-bottom: 15px;
    }

    /* 级联框高度 */
    .el-cascader-menu__wrap {
      height: 300px;
    }
  </style>
</head>

<body>
  <div id="app">
    <div style="padding:0 5px;">
      <el-row>
        <el-col :span="6"><img src="../images/aeec_logo.png" height="60" alt="黎阳LOGO" /></el-col>
        <el-col :span="12" class="header-title">准时完成率趋势看板</el-col>
        <el-col :span="6" class="currentTime">{{currentTime}}</el-col>
      </el-row>

      <!-- 查询条件区 -->
      <el-form :inline="true" :model="queryInfo" ref="queryInfoRef" :label-position="'left'" :rules="rules">
        <el-form-item label="组织结构:" prop="org" v-if="boardType != 2">
          <el-cascader :options="orginazition" :props="{ checkStrictly: true}" ref="orginazitionRef"
            v-model="queryInfo.selectOrg" clearable style="width:340px;" @change="selectOrgChange">
          </el-cascader>
        </el-form-item>

        <el-form-item label="颗粒度:" v-if="boardType != 2">
          <el-input v-model="queryInfo.kld" style="width:100px;" disabled></el-input>
        </el-form-item>

        <el-form-item label="颗粒度:" v-if="boardType != 2">
          <el-select v-model="queryInfo.trendType" placeholder="请选择" style="width:100px;">
            <el-option :key="'月'" :label="'月'" :value="'月'"></el-option>
            <el-option :key="'周'" :label="'周'" :value="'周'"></el-option>
            <el-option :key="'日'" :label="'日'" :value="'日'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="计划完成时间:" v-if="boardType != 2">
          <el-date-picker v-model="queryInfo.plannedfinishdate" type="daterange" range-separator="至"
            value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="完工时间:" prop="checkdate">
          <el-date-picker v-model="queryInfo.checkdate" type="daterange" range-separator="至" value-format="yyyy-MM-dd"
            start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="small" @click="getData">查询</el-button>
        </el-form-item>
      </el-form>

      <dv-border-box-11 :title="boardType === 2  ? '计划准确性' : '均值及标准差'">
        <div :style="{height: chartHeight + 'px',paddingTop:'40px'}" id="barChart"></div>
      </dv-border-box-11>

      <dv-border-box-11 :title="'均值及标准差趋势'" v-if="boardType != 2">
        <div :style="{height: chartHeight + 'px',paddingTop:'40px'}" id="trendChart"></div>
      </dv-border-box-11>

      <!-- 工人均值及标准差趋势 -->
      <el-dialog :title="queryInfo.worker + '均值及标准差趋势'" :width="'98%'" :top="'10px'" :center="true"
        :visible.sync="workerTrendChartVisiable" @opened="workerChartDialogOpened">
        <div id="worker-trend" style="width:100%;height:400px;"></div>
      </el-dialog>

      <!-- 柱状图明细 -->
      <el-dialog :title="barChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="barChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="barChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="分厂" prop="factoryname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="工区" prop="workcentername" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="班组" prop="teamname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="工人" prop="reportemployeename" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="工序" prop="workflowstepname" width="140" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划完成时间" prop="plannedfinishdate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="完工时间" prop="checkdate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="排产时间" prop="stepplancreatedate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="完工时间差" prop="delaydays" width="120"></el-table-column>
          <el-table-column label="状态" prop="status" width="100">
            <template slot-scope="scope" v-if="scope.row.status">
              <el-tag v-if="scope.row.status === '超期完成'" type="danger">超期完成</el-tag>
              <el-tag v-else type="success">按时完成</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="100">
            <template slot-scope="scope">
              <el-button type="primary" icon="el-icon-download" size="mini" @click="exportBarChartDetail">导出</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @current-change="handleBarChartCurrentChange"
          :current-page="barChartDetail.queryInfo.currentPage" :page-sizes="[barChartDetail.queryInfo.pageSize]"
          :page-size="barChartDetail.queryInfo.pageSize" layout="prev,pager,next,jumper,sizes,total"
          :total="barChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 折线图明细 -->
      <el-dialog :title="lineChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="lineChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="lineChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="分厂" prop="factoryname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="工区" prop="workcentername" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="班组" prop="teamname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="工人" prop="reportemployeename" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="工序" prop="workflowstepname" width="140" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划完成时间" prop="plannedfinishdate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="完工时间" prop="checkdate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="排产时间" prop="stepplancreatedate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="完工时间差" prop="delaydays" width="120"></el-table-column>
          <el-table-column label="状态" prop="status" width="100">
            <template slot-scope="scope" v-if="scope.row.status">
              <el-tag v-if="scope.row.status === '超期完成'" type="danger">超期完成</el-tag>
              <el-tag v-else type="success">按时完成</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="100">
            <template slot-scope="scope">
              <el-button type="primary" icon="el-icon-download" size="mini" @click="exportLineChartDetail">导出
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @current-change="handleLineChartCurrentChange"
          :current-page="lineChartDetail.queryInfo.currentPage" :page-sizes="[lineChartDetail.queryInfo.pageSize]"
          :page-size="lineChartDetail.queryInfo.pageSize" layout="prev,pager,next,jumper,sizes,total"
          :total="lineChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 工人折线图明细 -->
      <el-dialog :title="workerLineChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="workerLineChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="workerLineChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="分厂" prop="factoryname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="工区" prop="workcentername" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="班组" prop="teamname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="工人" prop="reportemployeename" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="工序" prop="workflowstepname" width="140" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划完成时间" prop="plannedfinishdate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="完工时间" prop="checkdate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="排产时间" prop="stepplancreatedate" width="120" :formatter="splitDate"></el-table-column>
          <el-table-column label="完工时间差" prop="delaydays" width="120"></el-table-column>
          <el-table-column label="状态" prop="status" width="100">
            <template slot-scope="scope" v-if="scope.row.status">
              <el-tag v-if="scope.row.status === '超期完成'" type="danger">超期完成</el-tag>
              <el-tag v-else type="success">按时完成</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="100">
            <template slot-scope="scope">
              <el-button type="primary" icon="el-icon-download" size="mini" @click="exportWorkerLineChartDetail">导出
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @current-change="handleWorkerLineChartCurrentChange"
          :current-page="workerLineChartDetail.queryInfo.currentPage"
          :page-sizes="[workerLineChartDetail.queryInfo.pageSize]" :page-size="workerLineChartDetail.queryInfo.pageSize"
          layout="prev,pager,next,jumper,sizes,total" :total="workerLineChartDetail.total">
        </el-pagination>
      </el-dialog>
    </div>
  </div>
  <script src="../Scripts/echarts/echarts-5.4.0.min.js"></script>
  <script type="module">
    import { getParams, fetchSuggestion } from '../Scripts/hooks/useCommonMethod.js'
    import { barOption, colorList } from '../Scripts/hooks/chartConfig.js'
    import { exportExcelData } from '../Scripts/hooks/useCommonMethod.js'
    import { getMESOrginazition } from '../Scripts/hooks/fetchAPI.js'
    import { prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth } from '../Scripts/hooks/useDateShortCut.js'
    import { splitDate } from '../Scripts/hooks/format.js'
    const app = new Vue({
      el: '#app',
      data: {
        boardType: 1,
        splitDate,
        currentTime: '',
        loading: false,
        loadingText: '数据加载中...',
        queryInfo: {
          selectOrg: [],
          plannedfinishdate: '',//要求完成时间
          checkdate: '',//完工时间
          seriesType: '全部',
          trendType: '日',
          kld: '公司',
          worker: ''
        },
        orginazition: [],//组织结构
        // 表单验证
        rules: { checkdate: [{ required: true, message: '完工时间不能为空', trigger: 'change' }] },
        workerTrendChartVisiable: false,
        // 柱状图明细
        barChartDetail: {
          dialogVisiable: false,
          queryInfo: { paramsName: '', currentPage: 1, pageSize: 12 },
          dataList: [], total: 0, title: ''
        },
        // 折线图明细
        lineChartDetail: {
          dialogVisiable: false,
          queryInfo: { paramsName: '', currentPage: 1, pageSize: 12 },
          dataList: [], total: 0, title: ''
        },
        // 工人折线图明细
        workerLineChartDetail: {
          dialogVisiable: false,
          queryInfo: { paramsName: '', currentPage: 1, pageSize: 12 },
          dataList: [], total: 0, title: ''
        },
        chartHeight: 360,
        chartRow: 2,
        loadingConfig: { text: '数据查询中...', effect: 'whirling', maskColor: 'transparent', textColor: '#fff' },
        pickerOptions: { shortcuts: [prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth] }
      },
      methods: {
        // 查询数据
        getData() {
          this.$refs['queryInfoRef'].validate(async (valid) => {
            if (!valid) {
              return this.$message.error('必填项不能为空');
            } else {
              this.getBarData();
              this.getLineChartData();
            }
          })
        },
        // 柱状图
        async getBarData() {
          echarts.dispose(document.getElementById("barChart"));
          let chart = echarts.init(document.getElementById('barChart'));
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/ContainerStepPlanTrendBoard.ashx?action=getBarData', {
            type: 'getBarData',
            ...this.queryInfo
          })

          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(document.getElementById("barChart"));
          chart = echarts.init(document.getElementById('barChart'));

          let arr_xAxis = [], arr_std = [], arr_avg = [];
          for (const i of data) {
            arr_xAxis.push(i.item);
            arr_std.push(i.std_val);//均值
            arr_avg.push(i.avg_val);//标准差
          }

          let option = barOption();
          option.legend.data = ['均值', '标准差'];//设置图例文字

          option.xAxis.data = arr_xAxis;
          option.yAxis[1].show = false;
          option.series[0].name = "均值";
          option.series[0].data = arr_avg.map((item) => {
            return {
              value: item,
              label: {
                position: item > 0 ? 'top' : 'insideBottomRight',
                textStyle: { color: '#fff' }
              },
              itemStyle: {
                normal: { barBorderRadius: item > 0 ? [5, 5, 0, 0] : [0, 0, 5, 5] }
              }
            }
          });

          option.series[0].label.color = colorList.blue.color;
          option.series[0].itemStyle.color.colorStops = colorList.blue.colorStops;

          option.series[1] = _.cloneDeep(option.series[0]);
          option.series[1].name = '标准差';
          option.series[1].data = arr_std;
          option.series[1].label.color = colorList.red.color;
          option.series[1].itemStyle.color.colorStops = colorList.red.colorStops;

          chart.setOption(option);
          chart.on('click', (params) => {
            if (this.queryInfo.selectOrg.length === 3) {
              this.workerTrendChartVisiable = true;
              this.queryInfo.worker = params.name;
            } else {
              this.barChartDetail.queryInfo.currentPage = 1
              this.barChartDetail.queryInfo.paramsName = params.name;
              this.barChartDetail.title = params.name + "明细"
              this.barChartDetail.dialogVisiable = true
              this.getBarChartDetail();
            }
          })
        },
        // 柱状图明细
        async getBarChartDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/ContainerStepPlanTrendBoard.ashx?action=getBarChartDetail', {
            type: 'getBarChartDetail',
            ...this.queryInfo,
            ...this.barChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.barChartDetail.dataList = data;
          this.barChartDetail.total = total;
        },
        // 柱状图明细导出
        exportBarChartDetail() {
          const config = {
            url: '../handler/board/ContainerStepPlanTrendBoard.ashx?action=exportBarChartDetail',
            data: {
              type: 'exportBarChartDetail',
              ...this.queryInfo,
              ...this.barChartDetail.queryInfo
            }
          }
          exportExcelData(config, this);
        },
        // 折线图
        async getLineChartData() {
          if (this.boardType === 2) {
            return
          }
          echarts.dispose(document.getElementById("trendChart"));
          let chart = echarts.init(document.getElementById('trendChart'));
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/ContainerStepPlanTrendBoard.ashx?action=getLineChartData', {
            type: 'getLineChartData',
            ...this.queryInfo
          })
          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(document.getElementById("trendChart"));
          chart = echarts.init(document.getElementById('trendChart'));

          let arr_xAxis = [], arr_std = [], arr_avg = [];
          for (const i of data) {
            arr_xAxis.push(i.item);
            arr_std.push(i.std_val);//均值
            arr_avg.push(i.avg_val);//标准差
          }

          let option = barOption();
          option.legend.data = ['均值', '标准差'];//设置图例文字
          option.xAxis.data = arr_xAxis;
          option.yAxis[1].show = false;

          option.series[0].name = "均值";
          option.series[0].data = arr_avg;
          option.series[0].type = 'line';
          option.series[0].symbolSize = 10;
          option.series[0].symbol = 'circle';// 折线图标记
          option.series[0].lineStyle = { width: 3, color: colorList.blue.color }
          option.series[0].label.color = colorList.blue.color;
          option.series[0].itemStyle.color.colorStops = colorList.blue.colorStops;

          option.series[1] = _.cloneDeep(option.series[0]);
          option.series[1] = {
            ...option.series[1],
            name: '标准差',
            data: arr_std,
            lineStyle: { color: colorList.red.color }
          };
          option.series[1].label.color = colorList.red.color;
          option.series[1].itemStyle.color.colorStops = colorList.red.colorStops;

          if (this.queryInfo.trendType === '日') {
            option.xAxis.axisLabel.rotate = 45;
            option.xAxis.axisLabel.formatter = function (val) {
              let arr = val.split('-');
              return arr[1] + '-' + arr[2];
            }
          }

          chart.setOption(option);
          chart.on('click', (params) => {
            this.lineChartDetail.queryInfo.currentPage = 1;
            this.lineChartDetail.queryInfo.paramsName = params.name;
            this.lineChartDetail.title = params.name + "明细";
            this.lineChartDetail.dialogVisiable = true;
            this.getLineChartDetail();
          })
        },
        // 折线图明细
        async getLineChartDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/ContainerStepPlanTrendBoard.ashx?action=getLineChartDetail', {
            type: 'getLineChartDetail',
            ...this.queryInfo,
            ...this.lineChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.lineChartDetail.dataList = data;
          this.lineChartDetail.total = total;
        },
        // 折线图导出
        exportLineChartDetail() {
          const config = {
            url: '../handler/board/ContainerStepPlanTrendBoard.ashx?action=exportLineChartDetail',
            data: {
              type: 'exportLineChartDetail',
              ...this.queryInfo,
              ...this.lineChartDetail.queryInfo
            }
          }
          exportExcelData(config, this);
        },
        // 工人折线图
        async workerChartDialogOpened() {
          echarts.dispose(document.getElementById("worker-trend"));
          let chart = echarts.init(document.getElementById('worker-trend'));
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/ContainerStepPlanTrendBoard.ashx?action=getWorkerTrend', {
            type: 'getWorkerTrend',
            ...this.queryInfo
          })

          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(document.getElementById("worker-trend"));
          chart = echarts.init(document.getElementById('worker-trend'));

          let arr_xAxis = [], arr_std = [], arr_avg = [];
          for (const i of data) {
            arr_xAxis.push(i.item);
            arr_std.push(i.std_val);//均值
            arr_avg.push(i.avg_val);//标准差
          }

          let option = barOption({ themeColor: 'dark' });
          option.legend.data = ['均值', '标准差'];//设置图例文字
          option.xAxis.data = arr_xAxis;
          option.yAxis[1].show = false;

          option.series[0].name = "均值";
          option.series[0].data = arr_avg;
          option.series[0].type = 'line';
          option.series[0].symbolSize = 10;
          option.series[0].symbol = 'circle';// 折线图标记
          option.series[0].lineStyle = { width: 3, color: colorList.blue.color }
          option.series[0].label.color = colorList.blue.color;
          option.series[0].itemStyle.color.colorStops = colorList.blue.colorStops;

          option.series[1] = _.cloneDeep(option.series[0]);
          option.series[1] = {
            ...option.series[1],
            name: '标准差',
            data: arr_std,
            lineStyle: { color: colorList.red.color }
          };
          option.series[1].label.color = colorList.red.color;
          option.series[1].itemStyle.color.colorStops = colorList.red.colorStops;

          if (this.queryInfo.trendType === '日') {
            option.xAxis.axisLabel.rotate = 45;
            option.xAxis.axisLabel.formatter = function (val) {
              let arr = val.split('-');
              return arr[1] + '-' + arr[2];
            }
          }

          chart.setOption(option);
          chart.on('click', (params) => {
            this.workerLineChartDetail.queryInfo.currentPage = 1;
            this.workerLineChartDetail.queryInfo.paramsName = params.name;
            this.workerLineChartDetail.title = `【${this.queryInfo.worker}】【${params.name}】明细`;
            this.workerLineChartDetail.dialogVisiable = true;
            this.getWorkerLineChartDetail();
          })
        },
        // 工人折线图明细
        async getWorkerLineChartDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/ContainerStepPlanTrendBoard.ashx?action=getWorkerTrendDetail', {
            type: 'getWorkerTrendDetail',
            ...this.queryInfo,
            ...this.workerLineChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.workerLineChartDetail.dataList = data;
          this.workerLineChartDetail.total = total;
        },
        // 工人折线图明细导出
        exportWorkerLineChartDetail() {
          const config = {
            url: '../handler/board/ContainerStepPlanTrendBoard.ashx?action=exportWorkerLineChartDetail',
            data: {
              type: 'exportWorkerLineChartDetail',
              ...this.queryInfo,
              ...this.workerLineChartDetail.queryInfo
            }
          }
          exportExcelData(config, this);
        },
        // 所选组织结构变更
        selectOrgChange(val) {
          const lenght = val.length;
          if (lenght === 0) {
            this.queryInfo.kld = '公司';
          } else if (lenght === 1) {
            this.queryInfo.kld = '分厂';
          } else if (lenght === 2) {
            this.queryInfo.kld = '工区';
          } else {
            this.queryInfo.kld = '班组';
          }
          this.getData();
        },
        // 柱状图明细分页
        handleBarChartCurrentChange(newPage) {
          this.barChartDetail.queryInfo.currentPage = newPage;
          this.getBarChartDetail();
        },
        // 折线图明细分页
        handleLineChartCurrentChange(newPage) {
          this.lineChartDetail.queryInfo.currentPage = newPage;
          this.getLineChartDetail();
        },
        // 工人折线图明细分页
        handleWorkerLineChartCurrentChange(newPage) {
          this.workerLineChartDetail.queryInfo.currentPage = newPage;
          this.getWorkerLineChartDetail();
        },
      },
      async created() {
        let paramValue = getParams("boardType");
        this.boardType = paramValue == 2 ? 2 : 1;
        if (this.boardType === 2) {
          this.chartHeight = window.innerHeight - 180;
        } else {
          this.chartHeight = (window.innerHeight - 140 - this.chartRow * 40) / this.chartRow;
        }
        let incrementNumber = () => {
          setTimeout(incrementNumber, 500);
          this.currentTime = dayjs().format('YYYY年MM月DD日  HH:mm:ss');
        }
        setTimeout(incrementNumber, 500);
        const startOfThisMonth = dayjs().startOf('month').format('YYYY-MM-DD');
        const endOfThisMonth = dayjs().endOf('month').format('YYYY-MM-DD');
        const lastMonthDay = dayjs().subtract(1, 'month').format('YYYY-MM-DD');
        const today = dayjs().format('YYYY-MM-DD');
        this.queryInfo.checkdate = [lastMonthDay, today];
        this.orginazition = await getMESOrginazition({ isMapping: '是', factoryCode: '600|601|607|608|609' });//盘轴、机匣、燃烧、叶片、结构件
        this.getBarData();
        this.getLineChartData();
      }
    })
  </script>
</body>

</html>